package com.btkjgc.utils;

public class TypeUtils
{
	public static enum ControlComandStatus
	{ // 控制命令状态
		NEW(0), // 未完成的请求
		FINISHED(1), // 完成的请求
		TIMEOUT(2), // 超时
		OCCUPIED(3), // 已经被占用
		EXCEPTION(40);// 异常状态

		int value;

		ControlComandStatus(int value)
		{
			this.value = value;
		}

		public int getValue()
		{
			return value;
		}

		public static ControlComandStatus valueOf(int i)
		{
			switch (i)
			{
			case 0:
				return NEW;
			case 1:
				return FINISHED;
			case 2:
				return TIMEOUT;
			case 3:
				return OCCUPIED;
			case 40:
				return EXCEPTION;
			default:
				return NEW;
			}
		}
	}

	// CarInfo 中字段workstatus
	public static enum VehicleStatus
	{
		READY(0x00), // 待机状态
		RENTBYCOIN(0x20), // 被投币器租用
		RENTBYMOBILEUSER(0x21), // 被手机租用
		MAINTAINENCE(0x02), // 维护当中
		EXCEPTION(0x40), // 异常状态
		RESERVED(0x01), // 预定状态
		STOPTIMEOUT(0x22), // 停车超时
		CROSSBORDER(0x42), // GPS 越界
		LOWBATTERY(0x41);// 低电量

		int value;

		VehicleStatus(int value)
		{
			this.value = value;
		}

		public static VehicleStatus valueOf(int value)
		{
			switch (value)
			{
			case 0x00:
				return READY;
			case 0x20:
				return RENTBYCOIN;
			case 0x21:
				return RENTBYMOBILEUSER;
			case 0x02:
				return MAINTAINENCE;
			case 0x40:
				return EXCEPTION;
			case 0x01:
				return RESERVED;
			case 0x22:
				return STOPTIMEOUT;
			case 0x42:
				return CROSSBORDER;
			case 0x41:
				return LOWBATTERY;
			default:
				return READY;
			}
		}

		public int getValue()
		{
			return value;
		}
	}
}
